<?php
// parse multiple attributes

$xmlText = "<?xml version=\"1.0\" standalone=\"yes\"?>
	<library>
		<author gender=\"female\" age=\"20\" origin=\"TW\" />
		<author gender=\"male\" age=\"18\" origin=\"HK\" />
	</library>";
$xml = simplexml_load_string($xmlText);

foreach ($xml->author->attributes() as $attrName => $value) {		//only first node be accessed.			
	echo "$attrName : $value \n";			
}
